package com.ruiyian.web.controller.secondaryaccident;

import com.ruiyian.common.core.controller.BaseController;
import com.ruiyian.common.core.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/boardinformation")
public class BoardInformationController extends BaseController {
    @Autowired
    private JdbcTemplate jdbcTemplate;

    @GetMapping("/getinformationlist")
    public AjaxResult getBoardOperationList(){
        System.out.println("id");
        String sqlSelect = "select * FROM board_operation_information WHERE del_flag='0'";
        List<Map<String, Object>> boardInformationList = jdbcTemplate.queryForList(sqlSelect);
        List<Object> informationoptional = new ArrayList<>();
        for(Map<String, Object> informatio:boardInformationList){
            Map<String, String> oneInfo = new HashMap<>();
            oneInfo.put("value", (String) informatio.get("content"));
            informationoptional.add(oneInfo);
        }
        return AjaxResult.success(informationoptional);
    }
}
